package com.sunzm.dynamic_rule.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * 各类外部链接创建工具类
 */
public class ConnectionUtils {
    private static final Logger logger = LoggerFactory.getLogger(ConnectionUtils.class);

    public static Connection getClickhouseConnection() throws Exception {
        //String ckDriver = "com.github.housepower.jdbc.ClickHouseDriver";
        String ckDriver = "ru.yandex.clickhouse.ClickHouseDriver";
        String ckUrl = "jdbc:clickhouse://82.156.210.70:8123/default";
        String table = "event_detail";

        Class.forName(ckDriver);
        Connection conn = DriverManager.getConnection(ckUrl);
        logger.debug("clickhouse jdbc 连接创建完成");
        return conn;
    }
}
